﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PhotoGallery.Model;
using PhotoGallery.BLL;
public partial class myalbum : System.Web.UI.Page
{
    protected string myalbums = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        User u = (User)Session["user"];
        if (u == null) Response.Redirect("login.aspx");
        else
        {
            if (!IsPostBack)
            {
                this.myalbums = showMyAlbums();
            }
        }
    }
    //显示我的所有相册
    private string showMyAlbums()
    {
        string list = "";
        AlbumAction a = new AlbumAction();
        List<Albums> abmlist = new List<Albums>();
        string uid = ((User)Session["user"]).Uid;
        //取得我的相册列表
        abmlist = a.allAlbumsofSomeone(uid);
        //循环取出所有相册
        foreach (Albums album in abmlist)
        {
            PhotoAction pa = new PhotoAction();
            Picture pic = pa.showPic(album.Cover);
            list += "<li><a href=albumshow.aspx?aid=" + album.Aid + " title=" + album.Title + "><img class='groupcover' src=" + pic.Pic + " width='200px' height='120px;'></a>" +
                    "<div class='iabout'><h2><a href=albumshow.aspx?aid=" + album.Aid + ">" + album.Title + "</a></h2>" +
                        "<div class='desc'>" + album.Desp + "</div></div></li>";
        }
        return list;
    }
}